package com.lx.constant.enums;

import com.lx.constant.consts.CommonConstant;
import com.lx.constant.consts.SqlKeyWordConstant;
import com.lx.constant.segment.Segment;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author lx
 * @create 2022/12/6 23:28
 **/
@Getter
@AllArgsConstructor
public enum SegmentEnum {
    /*****************基础构建****************/
    CUSTOM_COMPLETE_SEGMENT("(任意)用户手动输入完整QL语句条件", CommonConstant.EMPTY, ConditionKeyWordEnum.COMMA),
    WHERE("(任意)普通条件", SqlKeyWordConstant.WHERE, ConditionKeyWordEnum.AND),
    LIMIT("(任意)分页条件", SqlKeyWordConstant.LIMIT, ConditionKeyWordEnum.COMMA),

    /*****************基础构建****************/
    /*****************更新构建****************/
    SET("(更新语句)更新列值条件", SqlKeyWordConstant.SET, ConditionKeyWordEnum.COMMA),
    /*****************更新构建****************/
    /*****************查询构建****************/
    COLUMN("(查询语句)列名条件", SqlKeyWordConstant.SELECT, ConditionKeyWordEnum.COMMA),
    HAVING("(查询语句)分组后聚合条件", SqlKeyWordConstant.HAVING, ConditionKeyWordEnum.AND),
    GROUP_BY("(查询语句)分组条件", SqlKeyWordConstant.GROUP_BY, ConditionKeyWordEnum.COMMA),
    ORDER_BY("(查询语句)排序条件", SqlKeyWordConstant.ORDER_BY, ConditionKeyWordEnum.COMMA),
    JOIN("(查询语句)关联条件", CommonConstant.EMPTY, ConditionKeyWordEnum.EMPTY),
    ON("(查询语句)ON条件", SqlKeyWordConstant.ON, ConditionKeyWordEnum.AND),
    /*****************查询构建****************/
    ;

    /**
     * 语句描述
     */
    private final String desc;

    /**
     * 关键字
     */
    private final String keyWord;

    /**
     * 分隔符,在拼接SQL时{@link Segment#needJoinSep(ConditionKeyWordEnum, Segment)}控制,该方法可重写
     */
    private final ConditionKeyWordEnum separator;

}
